<template>
  <div class="page">
    <div class="breadcrumb">
      <span class="bc-item" v-for="(name,i) in breadcrumb" :key="i">{{ name }}</span>
    </div>
    <div class="page-title">问卷调查</div>

   <van-form ref="form">
      <div class="borderText">
        <van-field :disabled="userNumberDisable" :rules="telRules" required :border="true" v-model="wjdcData.userNumber" type="tel" label="用户号码" placeholder="用户号码"
                   label-width="40%"/>
      </div>
     <van-collapse v-model="activeName" accordion @change="dataChange">
       <van-collapse-item title="服务" name="1" :value="wjdcListData.fw.myd === 1? '满意' : '不满意'">
         <van-collapse v-model="activeName_2" accordion @change="dataChange">
           <van-collapse-item title="营业厅" name="1" :value="wjdcListData.fw.yyt.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.fw.yyt.detail"
               name="营业厅"
               placeholder="请输入不满意的营业厅名称"
             />
           </van-collapse-item>
           <van-collapse-item title="联通App" name="2" :value="wjdcListData.fw.ltapp.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.fw.ltapp.detail"
               name="联通App"
               placeholder="请输入不满意的联通App名称"
             />
           </van-collapse-item>
           <van-collapse-item title="热线电话" name="3" :value="wjdcListData.fw.rxdh.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.fw.rxdh.detail"
               name="热线电话"
               placeholder="请输入不满意的热线电话"
             />
           </van-collapse-item>
           <van-collapse-item title="服务人员态度" name="4" :value="wjdcListData.fw.ffry.myd === 1? '满意' : '不满意'">
             <van-field name="checkboxGroup" label="请选择不满意的服务人员" label-width="60%">
               <template #input>
                 <van-checkbox-group v-model="wjdcListData.fw.ffry.detail">
                   <van-checkbox class="checkbox" name="zjgcs">智家工程师</van-checkbox>
                   <van-checkbox class="checkbox" name="yyy">营业员</van-checkbox>
                   <van-checkbox class="checkbox" name="khjl">客户经理</van-checkbox>
                   <van-checkbox class="checkbox" name="wygcs">网优工程师</van-checkbox>
                 </van-checkbox-group>
               </template>
             </van-field>
           </van-collapse-item>
         </van-collapse>
       </van-collapse-item>
       <van-collapse-item title="资费" name="2" :value="wjdcListData.zf.myd === 1? '满意' : '不满意'">
         <van-collapse v-model="activeName_2" accordion @change="dataChange">
           <van-collapse-item title="套餐" name="1" :value="wjdcListData.zf.tc.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.zf.tc.detail"
               name="套餐"
               placeholder="请输入不满意的套餐名称"
             />
           </van-collapse-item>
           <van-collapse-item title="消费扣费" name="2" :value="wjdcListData.zf.xf.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.zf.xf.detail"
               name="消费扣费"
               placeholder="请输入不满意的消费扣费问题"
             />
           </van-collapse-item>
           <van-collapse-item title="限速" name="3" :value="wjdcListData.zf.xs.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.zf.xs.detail"
               name="限速"
               placeholder="请输入限速速率与限速时间"
             />
           </van-collapse-item>
         </van-collapse>
       </van-collapse-item>
       <van-collapse-item title="移动网络" name="3" :value="wjdcListData.ydwl.myd === 1? '满意' : '不满意'">
         <van-collapse v-model="activeName_3" accordion @change="dataChange">
           <van-collapse-item title="上网" name="1" :value="wjdcListData.ydwl.sw.myd === 1? '满意' : '不满意'">
             <van-collapse v-model="activeName_4" accordion @change="dataChange">
               <van-collapse-item title="上不了网" name="1" :value="wjdcListData.ydwl.sw.sblw.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.sw.sblw.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="速率慢" name="2" :value="wjdcListData.ydwl.sw.slm.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.sw.slm.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="游戏卡顿" name="3" :value="wjdcListData.ydwl.sw.yxkd.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.sw.yxkd.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="视频卡顿" name="4" :value="wjdcListData.ydwl.sw.spkd.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.sw.spkd.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
             </van-collapse>
           </van-collapse-item>
           <van-collapse-item title="语音" name="2" :value="wjdcListData.ydwl.yy.myd === 1? '满意' : '不满意'">
             <van-collapse v-model="activeName_5" accordion @change="dataChange">
               <van-collapse-item title="打不出电话" name="1" :value="wjdcListData.ydwl.yy.dbcdh.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.yy.dbcdh.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="接不了电话" name="2" :value="wjdcListData.ydwl.yy.jbldh.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.yy.jbldh.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="频繁掉话" name="3" :value="wjdcListData.ydwl.yy.pfdh.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.yy.pfdh.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="语音吞字断续" name="4" :value="wjdcListData.ydwl.yy.yytzdx.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.yy.yytzdx.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
               <van-collapse-item title="单通" name="5" :value="wjdcListData.ydwl.yy.dt.myd === 1? '满意' : '不满意'">
                 <van-field
                   v-model="wjdcListData.ydwl.yy.dt.detail"
                   rows="2"
                   autosize
                   label-width="80"
                   type="textarea"
                   maxlength="500"
                   placeholder="频次：经常、偶尔、单次 || 具体内容：时间、地点（具体到小区门排）"
                   show-word-limit
                 />
               </van-collapse-item>
             </van-collapse>
           </van-collapse-item>
           <van-collapse-item title="同时使用移动/电信卡" name="3" :value="wjdcListData.ydwl.ys.myd === 1? '满意' : '不满意'">
             <van-field name="checkboxGroup" label="对移动/电信是否满意" label-width="60%">
               <template #input>
                 <van-radio-group v-model="wjdcListData.ydwl.ys.if_yddx">
                   <van-radio class="checkbox" name="1">满意</van-radio>
                   <van-radio class="checkbox" name="2">不满意</van-radio>
                   <van-radio class="checkbox" name="3">未使用友商服务</van-radio>
                 </van-radio-group>
               </template>
             </van-field>
           </van-collapse-item>
         </van-collapse>
       </van-collapse-item>
       <van-collapse-item title="宽带网络" name="4" :value="wjdcListData.kdwl.sw.myd === 1? '满意' : '不满意'">
         <van-collapse v-model="activeName_6" accordion @change="dataChange">
           <van-collapse-item title="上不了网" name="1" :value="wjdcListData.kdwl.sw.sblw.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.kdwl.sw.sblw.detail"
               rows="2"
               autosize
               label-width="80"
               type="textarea"
               maxlength="500"
               placeholder="频次：经常、偶尔、单次 || 宽带账号"
               show-word-limit
             />
           </van-collapse-item>
           <van-collapse-item title="速率慢" name="2":value="wjdcListData.kdwl.sw.slm.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.kdwl.sw.slm.detail"
               rows="2"
               autosize
               label-width="80"
               type="textarea"
               maxlength="500"
               placeholder="频次：经常、偶尔、单次 || 宽带账号"
               show-word-limit
             />
           </van-collapse-item>
           <van-collapse-item title="游戏卡顿" name="3" :value="wjdcListData.kdwl.sw.yxkd.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.kdwl.sw.yxkd"
               rows="2"
               autosize
               label-width="80"
               type="textarea"
               maxlength="500"
               placeholder="频次：经常、偶尔、单次 || 宽带账号"
               show-word-limit
             />
           </van-collapse-item>
           <van-collapse-item title="视频卡顿" name="4" :value="wjdcListData.kdwl.sw.spkd.myd === 1? '满意' : '不满意'">
             <van-field
               v-model="wjdcListData.kdwl.sw.spkd"
               rows="2"
               autosize
               label-width="80"
               type="textarea"
               maxlength="500"
               placeholder="频次：经常、偶尔、单次 || 宽带账号"
               show-word-limit
             />
           </van-collapse-item>
         </van-collapse>
       </van-collapse-item>
     </van-collapse>
    </van-form>
    <div v-if="finishFlag">
      <div style="margin: 16px; text-align: center">
        <div class="form-btn disabled" >当前小区任务已完成</div>
      </div>
    </div>
    <div v-else>
      <div style="margin: 16px; text-align: center">
        <div class="form-btn" @click="handleSubmit">提交问卷调查结果</div>
      </div>
      <div style="margin: 16px; text-align: center">
        <van-dialog
          v-model="deleteShow"
          title="删除问卷调查结果"
          show-cancel-button
          @cancel="deleteShow = false"
          @confirm="handleDelete"
        ></van-dialog>
        <div class="form-btn danger" v-if="wjdcId !== '' && wjdcId !== undefined && wjdcId !== null && this.type === '3'" @click="handleDeleteShow">删除问卷调查结果</div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  submitWjdcResult,
  communityWjdcPercent,
  deleteWjdcResult,
  getCommunityInfo,
  submitWjdcNewResult,
  communityWjdcNewPercent,
  deleteWjdcNewResult
} from '@/api/publicline/kdcs'
import { Toast} from 'vant'
import {geometry, getCurrentLocation} from "@/utils/geo";

export default {
  data() {
    return {
      activeName: '',
      activeName_2: '',
      activeName_3: '',
      activeName_4: '',
      activeName_5: '',
      activeName_6: '',
      userNumberDisable: false,
      finishFlag: false,
      deleteShow: false,
      wjdcId: '',
      communityId: '',
      breadcrumb: [],
      location: '',
      // 校验手机号码
      telRules: [{
        required: true,
        message: '手机号码不能为空',
        trigger: 'onBlur'
      }, {
        // 自定义校验规则
        validator: value => {
          return /^1[3456789]\d{9}$/.test(value)
        },
        message: '请输入正确格式的手机号码',
        trigger: 'onBlur'
      }],
      wjdcListData: {
        myd: 1,
        fw: {
          myd: 1,
          yyt: {
            myd: 1,
            detail: ''
          },
          ltapp: {
            myd: 1,
            detail: ''
          },
          rxdh: {
            myd: 1,
            detail: ''
          },
          ffry: {
            myd: 1,
            detail: []
          },
        },
        zf: {
          myd: 1,
          tc: {
            myd: 1,
            detail: ''
          },
          xf: {
            myd: 1,
            detail: ''
          },
          xs: {
            myd: 1,
            detail: ''
          }
        },
        ydwl: {
          myd: 1,
          sw: {
            myd: 1,
            sblw: {
              myd: 1,
              detail: ''
            },
            slm: {
              myd: 1,
              detail: ''
            },
            yxkd: {
              myd: 1,
              detail: ''
            },
            spkd: {
              myd: 1,
              detail: ''
            }
          },
          yy: {
            myd: 1,
            dbcdh: {
              myd: 1,
              detail: ''
            },
            jbldh: {
              myd: 1,
              detail: ''
            },
            pfdh: {
              myd: 1,
              detail: ''
            },
            yytzdx: {
              myd: 1,
              detail: ''
            },
            dt: {
              myd: 1,
              detail: ''
            }
          },
          ys: {
            if_yddx: '',
            myd: 1
          }
        },
        kdwl: {
          myd: 1,
          sw: {
            myd: 1,
            sblw: {
              myd: 1,
              detail: ''
            },
            slm: {
              myd: 1,
              detail: ''
            },
            yxkd: {
              myd: 1,
              detail: ''
            },
            spkd: {
              myd: 1,
              detail: ''
            }
          }
        }
      },
      wjdcData: {
        id: '',
        villageId: '',
        userNumber: ''
      },
      communityInfo: {}
    }
  },
  created() {
    const {communityId, breadcrumb, wjdcId, type} = this.$route.query
    this.communityId = communityId
    this.breadcrumb = breadcrumb.split('/')
    this.wjdcId = wjdcId
    this.type = type
    if(wjdcId !== '' && wjdcId !== undefined && wjdcId !== null) {
      this.searchWjdc()
    }
    this.getCommunityInfo()
    this.wjdcData.villageId = this.communityId
    getCurrentLocation( (info) => {
      this.location = info;
    }, () => {
      Toast.fail("当前定位获取失败")
    } )
  },
  methods: {
    getCommunityInfo() {
      getCommunityInfo( { VILLAGE_ID: this.communityId } )
        .then( res => {
          if ( res.success ) {
            const data = res.result.data;
            this.communityInfo = data;
            this.communityInfo.xqwl = JSON.parse(data.xqwl);
            if(data.state === '2') {
              this.finishFlag = true
            }
          }
        } )
    },
    searchWjdc() {
      communityWjdcNewPercent({ id: this.wjdcId })
        .then(
          res => {
            if (res.success) {
              this.userNumberDisable = (this.type === '1' || this.type === '2')
              const data = res.result
              this.wjdcData = data.list[0]

              this.wjdcListData.myd	=	data.list[0].wjdcMyd
              this.wjdcListData.fw.myd	=	data.list[0].fwMyd
              this.wjdcListData.fw.yyt.myd	=	data.list[0].yytMyd
              this.wjdcListData.fw.yyt.detail	=	data.list[0].yytDetail
              this.wjdcListData.fw.ltapp.myd	=	data.list[0].ltappMyd
              this.wjdcListData.fw.ltapp.detail	=	data.list[0].ltappDetail
              this.wjdcListData.fw.rxdh.myd	=	data.list[0].rxdhMyd
              this.wjdcListData.fw.rxdh.detail	=	data.list[0].rxdhDetail
              this.wjdcListData.fw.ffry.myd	=	data.list[0].ffryMyd
              if(data.list[0].ffryDetail !== '' && data.list[0].ffryDetail != null) {
                this.wjdcListData.fw.ffry.detail = data.list[0].ffryDetail.split(',')
              } else {
                this.wjdcListData.fw.ffry.detail = []
              }
              this.wjdcListData.zf.myd	=	data.list[0].zfMyd
              this.wjdcListData.zf.tc.myd	=	data.list[0].tcMyd
              this.wjdcListData.zf.tc.detail	=	data.list[0].tcDetail
              this.wjdcListData.zf.xf.myd	=	data.list[0].xfMyd
              this.wjdcListData.zf.xf.detail	=	data.list[0].xfDetail
              this.wjdcListData.zf.xs.myd	=	data.list[0].xsMyd
              this.wjdcListData.zf.xs.detail	=	data.list[0].xsDetail
              this.wjdcListData.ydwl.myd	=	data.list[0].ydwlMyd
              this.wjdcListData.ydwl.sw.myd	=	data.list[0].swMyd
              this.wjdcListData.ydwl.sw.sblw.myd	=	data.list[0].ydwlSblwMyd
              this.wjdcListData.ydwl.sw.sblw.detail	=	data.list[0].ydwlSblwDetail
              this.wjdcListData.ydwl.sw.slm.myd	=	data.list[0].ydwlSlmMyd
              this.wjdcListData.ydwl.sw.slm.detail	=	data.list[0].ydwlSlmDetail
              this.wjdcListData.ydwl.sw.yxkd.myd	=	data.list[0].ydwlYxkdMyd
              this.wjdcListData.ydwl.sw.yxkd.detail	=	data.list[0].ydwlYxkdDetail
              this.wjdcListData.ydwl.sw.spkd.myd	=	data.list[0].ydwlSpkdMyd
              this.wjdcListData.ydwl.sw.spkd.detail	=	data.list[0].ydwlSpkdDetail
              this.wjdcListData.ydwl.yy.myd	=	data.list[0].yyMyd
              this.wjdcListData.ydwl.yy.dbcdh.myd	=	data.list[0].dbcdhMyd
              this.wjdcListData.ydwl.yy.dbcdh.detail	=	data.list[0].dbcdhDetail
              this.wjdcListData.ydwl.yy.jbldh.myd	=	data.list[0].jbldhMyd
              this.wjdcListData.ydwl.yy.jbldh.detail	=	data.list[0].jbldhDetail
              this.wjdcListData.ydwl.yy.pfdh.myd	=	data.list[0].pfdhMyd
              this.wjdcListData.ydwl.yy.pfdh.detail	=	data.list[0].pfdhDetail
              this.wjdcListData.ydwl.yy.yytzdx.myd	=	data.list[0].yytzdxMyd
              this.wjdcListData.ydwl.yy.yytzdx.detail	=	data.list[0].yytzdxDetail
              this.wjdcListData.ydwl.yy.dt.myd	=	data.list[0].dtMyd
              this.wjdcListData.ydwl.yy.dt.detail	=	data.list[0].dtDetail
              this.wjdcListData.ydwl.ys.myd	=	data.list[0].ysMyd
              this.wjdcListData.ydwl.ys.ifYddx	=	data.list[0].ifYddx
              this.wjdcListData.kdwl.myd	=	data.list[0].kdwlMyd
              this.wjdcListData.kdwl.sw.sblw.myd	=	data.list[0].kdwlSblwMyd
              this.wjdcListData.kdwl.sw.sblw.detail	=	data.list[0].kdwlSblwDetail
              this.wjdcListData.kdwl.sw.slm.myd	=	data.list[0].kdwlSlmMyd
              this.wjdcListData.kdwl.sw.slm.detail	=	data.list[0].kdwlSlmDetail
              this.wjdcListData.kdwl.sw.yxkd.myd	=	data.list[0].kdwlYxkdMyd
              this.wjdcListData.kdwl.sw.yxkd.detail	=	data.list[0].kdwlYxkdDetail
              this.wjdcListData.kdwl.sw.spkd.myd	=	data.list[0].kdwlSpkdMyd
              this.wjdcListData.kdwl.sw.spkd.detail	=	data.list[0].kdwlSpkdDetail

              this.dataChange()
            }
          }
        )
    },
    handleSubmit() {
      const center = this.location
      let xqwl = []
      for ( const item of this.communityInfo.xqwl ) {
        xqwl.push( item.join(',') )
      }
      xqwl = xqwl.join(';')


      this.wjdcData = {
        ...this.wjdcData,
        type: this.type,
        LOCATION: this.location
      }
      this.wjdcData.wjdcMyd = this.wjdcListData.myd
      this.wjdcData.fwMyd = this.wjdcListData.fw.myd
      this.wjdcData.yytMyd = this.wjdcListData.fw.yyt.myd
      this.wjdcData.yytDetail = this.wjdcListData.fw.yyt.detail
      this.wjdcData.ltappMyd = this.wjdcListData.fw.ltapp.myd
      this.wjdcData.ltappDetail = this.wjdcListData.fw.ltapp.detail
      this.wjdcData.rxdhMyd = this.wjdcListData.fw.rxdh.myd
      this.wjdcData.rxdhDetail = this.wjdcListData.fw.rxdh.detail
      this.wjdcData.ffryMyd = this.wjdcListData.fw.ffry.myd
      this.wjdcData.ffryDetail = this.wjdcListData.fw.ffry.detail.join(',')
      this.wjdcData.zfMyd = this.wjdcListData.zf.myd
      this.wjdcData.tcMyd = this.wjdcListData.zf.tc.myd
      this.wjdcData.tcDetail = this.wjdcListData.zf.tc.detail
      this.wjdcData.xfMyd = this.wjdcListData.zf.xf.myd
      this.wjdcData.xfDetail = this.wjdcListData.zf.xf.detail
      this.wjdcData.xsMyd = this.wjdcListData.zf.xs.myd
      this.wjdcData.xsDetail = this.wjdcListData.zf.xs.detail
      this.wjdcData.ydwlMyd = this.wjdcListData.ydwl.myd
      this.wjdcData.swMyd = this.wjdcListData.ydwl.sw.myd
      this.wjdcData.ydwlSblwMyd = this.wjdcListData.ydwl.sw.sblw.myd
      this.wjdcData.ydwlSblwDetail = this.wjdcListData.ydwl.sw.sblw.detail
      this.wjdcData.ydwlSlmMyd = this.wjdcListData.ydwl.sw.slm.myd
      this.wjdcData.ydwlSlmDetail = this.wjdcListData.ydwl.sw.slm.detail
      this.wjdcData.ydwlYxkdMyd = this.wjdcListData.ydwl.sw.yxkd.myd
      this.wjdcData.ydwlYxkdDetail = this.wjdcListData.ydwl.sw.yxkd.detail
      this.wjdcData.ydwlSpkdMyd = this.wjdcListData.ydwl.sw.spkd.myd
      this.wjdcData.ydwlSpkdDetail = this.wjdcListData.ydwl.sw.spkd.detail
      this.wjdcData.yyMyd = this.wjdcListData.ydwl.yy.myd
      this.wjdcData.dbcdhMyd = this.wjdcListData.ydwl.yy.dbcdh.myd
      this.wjdcData.dbcdhDetail = this.wjdcListData.ydwl.yy.dbcdh.detail
      this.wjdcData.jbldhMyd = this.wjdcListData.ydwl.yy.jbldh.myd
      this.wjdcData.jbldhDetail = this.wjdcListData.ydwl.yy.jbldh.detail
      this.wjdcData.pfdhMyd = this.wjdcListData.ydwl.yy.pfdh.myd
      this.wjdcData.pfdhDetail = this.wjdcListData.ydwl.yy.pfdh.detail
      this.wjdcData.yytzdxMyd = this.wjdcListData.ydwl.yy.yytzdx.myd
      this.wjdcData.yytzdxDetail = this.wjdcListData.ydwl.yy.yytzdx.detail
      this.wjdcData.dtMyd = this.wjdcListData.ydwl.yy.dt.myd
      this.wjdcData.dtDetail = this.wjdcListData.ydwl.yy.dt.detail
      this.wjdcData.ysMyd = this.wjdcListData.ydwl.ys.myd
      this.wjdcData.ifYddx = this.wjdcListData.ydwl.ys.ifYddx
      this.wjdcData.kdwlMyd = this.wjdcListData.kdwl.myd
      this.wjdcData.kdwlSblwMyd = this.wjdcListData.kdwl.sw.sblw.myd
      this.wjdcData.kdwlSblwDetail = this.wjdcListData.kdwl.sw.sblw.detail
      this.wjdcData.kdwlSlmMyd = this.wjdcListData.kdwl.sw.slm.myd
      this.wjdcData.kdwlSlmDetail = this.wjdcListData.kdwl.sw.slm.detail
      this.wjdcData.kdwlYxkdMyd = this.wjdcListData.kdwl.sw.yxkd.myd
      this.wjdcData.kdwlYxkdDetail = this.wjdcListData.kdwl.sw.yxkd.detail
      this.wjdcData.kdwlSpkdMyd = this.wjdcListData.kdwl.sw.spkd.myd
      this.wjdcData.kdwlSpkdDetail = this.wjdcListData.kdwl.sw.spkd.detail

      geometry(xqwl, center, 'distance', (distance) => {
        if ( distance < 100 ) {
          this.wjdcData = {
            ...this.wjdcData,
            type: this.type,
            LOCATION: this.location
          }
          this.$refs.form.validate().then(() => {
            submitWjdcNewResult( this.wjdcData )
              .then ( res => {
                if ( res.success ) {
                  const data = res.result;
                  Toast.success("问卷调查提交完成")
                  // 打卡成功
                  this.$router.go( -1)
                }
              } )
          }).catch(() => {
            this.$toast.fail('提交失败')
          })
        } else {
          Toast.fail('未到达小区范围，不允许提交结果');
        }
      })
    },
    handleDeleteShow() {
      this.deleteShow = true
    },
    handleDelete() {
      const center = this.location
      let xqwl = []
      for ( const item of this.communityInfo.xqwl ) {
        xqwl.push( item.join(',') )
      }
      xqwl = xqwl.join(';')

      geometry(xqwl, center, 'distance', (distance) => {
        if ( distance < 100 ) {
          deleteWjdcNewResult( {
            id: this.wjdcId,
            LOCATION: this.location
          } )
            .then ( res => {
              if ( res.success ) {
                Toast.success("问卷调查删除完成")
                // 打卡成功
                this.$router.go( -1)
              }
            } )
        } else {
          Toast.fail('未到达小区范围，不允许提交结果');
        }
      })
    },
    dataChange() {
      this.wjdcListData.fw.yyt.myd = (this.wjdcListData.fw.yyt.detail !== '' && this.wjdcListData.fw.yyt.detail != null)? 2 : 1
      this.wjdcListData.fw.ltapp.myd = (this.wjdcListData.fw.ltapp.detail !== '' && this.wjdcListData.fw.ltapp.detail != null)? 2 : 1
      this.wjdcListData.fw.rxdh.myd = (this.wjdcListData.fw.rxdh.detail !== '' && this.wjdcListData.fw.rxdh.detail != null)? 2 : 1
      this.wjdcListData.fw.ffry.myd = (this.wjdcListData.fw.ffry.detail.length > 0)? 2 : 1

      this.wjdcListData.zf.tc.myd = (this.wjdcListData.zf.tc.detail !== '' && this.wjdcListData.zf.tc.detail != null)? 2 : 1
      this.wjdcListData.zf.xf.myd = (this.wjdcListData.zf.xf.detail !== '' && this.wjdcListData.zf.xf.detail != null)? 2 : 1
      this.wjdcListData.zf.xs.myd = (this.wjdcListData.zf.xs.detail !== '' && this.wjdcListData.zf.xs.detail != null)? 2 : 1

      this.wjdcListData.ydwl.sw.sblw.myd = (this.wjdcListData.ydwl.sw.sblw.detail !== '' && this.wjdcListData.ydwl.sw.sblw.detail != null)? 2 : 1
      this.wjdcListData.ydwl.sw.slm.myd = (this.wjdcListData.ydwl.sw.slm.detail !== '' && this.wjdcListData.ydwl.sw.slm.detail != null)? 2 : 1
      this.wjdcListData.ydwl.sw.yxkd.myd = (this.wjdcListData.ydwl.sw.yxkd.detail !== '' && this.wjdcListData.ydwl.sw.yxkd.detail != null)? 2 : 1
      this.wjdcListData.ydwl.sw.spkd.myd = (this.wjdcListData.ydwl.sw.spkd.detail !== '' && this.wjdcListData.ydwl.sw.spkd.detail != null)? 2 : 1

      this.wjdcListData.ydwl.yy.dbcdh.myd = (this.wjdcListData.ydwl.yy.dbcdh.detail !== '' && this.wjdcListData.ydwl.yy.dbcdh.detail != null)? 2 : 1
      this.wjdcListData.ydwl.yy.jbldh.myd = (this.wjdcListData.ydwl.yy.jbldh.detail !== '' && this.wjdcListData.ydwl.yy.jbldh.detail != null)? 2 : 1
      this.wjdcListData.ydwl.yy.pfdh.myd = (this.wjdcListData.ydwl.yy.pfdh.detail !== '' && this.wjdcListData.ydwl.yy.pfdh.detail != null)? 2 : 1
      this.wjdcListData.ydwl.yy.yytzdx.myd = (this.wjdcListData.ydwl.yy.yytzdx.detail !== '' && this.wjdcListData.ydwl.yy.yytzdx.detail != null)? 2 : 1
      this.wjdcListData.ydwl.yy.dt.myd = (this.wjdcListData.ydwl.yy.dt.detail !== '' && this.wjdcListData.ydwl.yy.dt.detail != null)? 2 : 1
      this.wjdcListData.ydwl.ys.myd = (this.wjdcListData.ydwl.ys.if_yddx === '1')? 2 : 1

      this.wjdcListData.kdwl.sw.sblw.myd = (this.wjdcListData.kdwl.sw.sblw.detail !== '' && this.wjdcListData.kdwl.sw.sblw.detail != null)? 2 : 1
      this.wjdcListData.kdwl.sw.slm.myd = (this.wjdcListData.kdwl.sw.slm.detail !== '' && this.wjdcListData.kdwl.sw.slm.detail != null)? 2 : 1
      this.wjdcListData.kdwl.sw.yxkd.myd = (this.wjdcListData.kdwl.sw.yxkd.detail !== '' && this.wjdcListData.kdwl.sw.yxkd.detail != null)? 2 : 1
      this.wjdcListData.kdwl.sw.spkd.myd = (this.wjdcListData.kdwl.sw.spkd.detail !== '' && this.wjdcListData.kdwl.sw.spkd.detail != null)? 2 : 1

      this.wjdcListData.fw.myd = ((
        this.wjdcListData.fw.yyt.myd +
        this.wjdcListData.fw.ltapp.myd +
        this.wjdcListData.fw.rxdh.myd +
        this.wjdcListData.fw.ffry.myd) === 4)? 1 : 2

      this.wjdcListData.zf.myd = ((
        this.wjdcListData.zf.tc.myd +
        this.wjdcListData.zf.xf.myd +
        this.wjdcListData.zf.xs.myd) === 3)? 1 : 2

      this.wjdcListData.ydwl.sw.myd = ((
        this.wjdcListData.ydwl.sw.sblw.myd +
        this.wjdcListData.ydwl.sw.slm.myd +
        this.wjdcListData.ydwl.sw.yxkd.myd +
        this.wjdcListData.ydwl.sw.spkd.myd) === 4)? 1 : 2

      this.wjdcListData.ydwl.yy.myd = ((
        this.wjdcListData.ydwl.yy.dbcdh.myd +
        this.wjdcListData.ydwl.yy.jbldh.myd +
        this.wjdcListData.ydwl.yy.pfdh.myd +
        this.wjdcListData.ydwl.yy.yytzdx.myd +
        this.wjdcListData.ydwl.yy.dt.myd) === 5)? 1 : 2

      this.wjdcListData.ydwl.myd = ((
        this.wjdcListData.ydwl.sw.myd +
        this.wjdcListData.ydwl.yy.myd) === 2)? 1 : 2

      this.wjdcListData.kdwl.sw.myd = ((
        this.wjdcListData.kdwl.sw.sblw.myd +
        this.wjdcListData.kdwl.sw.slm.myd +
        this.wjdcListData.kdwl.sw.yxkd.myd +
        this.wjdcListData.kdwl.sw.spkd.myd) === 4)? 1 : 2

      this.wjdcListData.myd = ((
        this.wjdcListData.fw.myd +
        this.wjdcListData.zf.myd +
        this.wjdcListData.ydwl.myd +
        this.wjdcListData.kdwl.myd) === 4)? 1 : 2
    }
  }
}
</script>

<style lang="less" scoped>
.page {
  background: #FFF;

  .disabled {
    background: #EEE;
    color: #777;
    border-color: #ccc;
  }
}

.radio-wrap {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.page-title {
  font-size: 14px;
  padding: 10px 6px;
  text-align: left;
  display: flex;
  align-items: center;

  &:before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 20px;
    background: #008cff;
    margin-right: 8px;
  }
}

.breadcrumb {
  min-height: 20px;
  border-bottom: 1px solid #ccc;
  font-size: 13px;
  padding: 6px 10px;
  background: #f2f9ff;

  .bc-item {
    color: #888;

    &:after {
      content: " / ";
    }

    &:last-child {
      color: #000;

      &:after {
        content: "";
      }
    }
  }
}

.form-btn {
  padding: 10px 10px;
  border-radius: 4px;
  background: #008cff;
  color: #FFF;

  &.danger {
    background: #ff3700;
    color: #FFF;
  }
}

.borderText::v-deep .van-field--value {
  border: 1px solid red;
}

.checkbox {
  margin: 5px;
}
</style>